package com.netease.pris.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.atom.g;
import com.netease.pris.atom.u;
import com.netease.pris.b;
import com.netease.pris.v;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Stack;

public class MallListActivity extends ActivityEx
{
  public static final int a = 0;
  public static final int b = 1;
  public static final int c = 4097;
  private LinearLayout A;
  private ProgressBar B;
  private TextView C;
  private RelativeLayout D;
  private AutoCompleteTextView E;
  private ImageView F;
  private ImageView G;
  private TextWatcher H = new cg(this);
  private AdapterView.OnItemClickListener I = new ci(this);
  public Context d = null;
  View.OnClickListener e = new ch(this);
  AbsListView.OnScrollListener f = new cf(this);
  b g = new ce(this);
  private boolean h = false;
  private int i = 0;
  private int j;
  private int k = 0;
  private int l = 0;
  private int m = 0;
  private String n = "server";
  private String o = null;
  private String p = null;
  private String q = null;
  private Stack r = null;
  private HashMap s;
  private InputMethodManager t;
  private TextView u;
  private ProgressBar v;
  private ListView w = null;
  private com.netease.pris.activity.a.al x = null;
  private com.netease.pris.activity.a.ad y;
  private View z;

  private int a(int paramInt, Object paramObject, String paramString1, String paramString2)
  {
    switch (paramInt)
    {
    default:
      this.i = 0;
    case 2:
    case 304:
    case 302:
    case 303:
    }
    while (true)
    {
      return this.i;
      this.i = v.a().f();
      continue;
      this.i = v.a().a(paramString1);
      continue;
      this.i = v.a().a((u)paramObject);
      continue;
      this.i = v.a().b((u)paramObject);
    }
  }

  private void a(int paramInt, com.netease.pris.protocol.d paramd)
  {
    try
    {
      switch (this.l)
      {
      case 1:
        if (!this.s.containsKey(new Integer(paramInt)))
          return;
        this.x.a("title" + paramInt, 0);
        ListAdapter localListAdapter = this.x.a("data" + paramInt, 0);
        if ((localListAdapter != null) && ((localListAdapter instanceof com.netease.pris.activity.a.ad)))
          ((com.netease.pris.activity.a.ad)localListAdapter).b(paramd.h);
        this.s.remove(new Integer(paramInt));
        if (this.s.size() != 0)
          return;
        e();
      case 2:
      }
    }
    catch (NullPointerException localNullPointerException)
    {
      localNullPointerException.printStackTrace();
    }
    finally
    {
    }
    if (this.s.containsKey(new Integer(paramInt)))
    {
      this.s.remove(new Integer(paramInt));
      b(paramd);
      e();
      if (1 == this.k)
      {
        this.y.a(paramd.h);
        this.k = 0;
        b(false);
      }
      while (true)
      {
        a(paramd);
        this.h = false;
        break;
        this.x.a();
        this.x.a("", this.y);
        this.x.a("", 0);
        this.y.c();
        this.y.a();
        this.y.b(paramd.h);
        this.w.setSelection(this.m);
        this.w.addFooterView(this.z);
        this.w.setAdapter(this.y);
        this.w.removeFooterView(this.z);
      }
    }
  }

  public static void a(Context paramContext)
  {
    paramContext.startActivity(new Intent(paramContext, MallListActivity.class));
  }

  private void a(com.netease.pris.protocol.d paramd)
  {
    String str1 = this.p;
    this.p = null;
    if (paramd.g == null);
    while (true)
    {
      return;
      String str2 = paramd.g.b(g.i);
      if (TextUtils.isEmpty(str2))
        continue;
      if (str2.equals(str1))
      {
        this.p = null;
        continue;
      }
      this.p = str2;
    }
  }

  private void b(com.netease.pris.protocol.d paramd)
  {
    String str = paramd.g.b(g.a);
    this.q = str;
    if (TextUtils.isEmpty(str))
      this.D.setVisibility(8);
    while (true)
    {
      return;
      this.D.setVisibility(0);
    }
  }

  private void b(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.A.setVisibility(0);
      this.B.setVisibility(0);
      this.C.setText(2131361949);
    }
    while (true)
    {
      return;
      this.A.setVisibility(8);
    }
  }

  private void c(com.netease.pris.protocol.d paramd)
  {
    try
    {
      this.x.a();
      this.w.addFooterView(this.z);
      this.w.setAdapter(this.x);
      this.w.removeFooterView(this.z);
      b(paramd);
      LinkedList localLinkedList = paramd.h;
      if ((localLinkedList != null) && (!localLinkedList.isEmpty()))
      {
        c();
        boolean bool;
        do
        {
          u localu = (u)localLinkedList.removeFirst();
          String str1 = localu.b(g.b);
          String str2 = localu.aR();
          if ((str1 != null) && (str1.length() > 0))
          {
            int i1 = a(304, null, str1, null);
            Integer localInteger = new Integer(i1);
            this.s.put(localInteger, str2);
            View localView = getLayoutInflater().inflate(2130903045, null, false);
            ((TextView)localView.findViewById(2131558422)).setText(str2);
            String[] arrayOfString = new String[7];
            arrayOfString[0] = "icon";
            arrayOfString[1] = "mark";
            arrayOfString[2] = "title";
            arrayOfString[3] = "content";
            arrayOfString[4] = "ratingbar";
            arrayOfString[5] = "button";
            arrayOfString[6] = "subs";
            int[] arrayOfInt = new int[7];
            arrayOfInt[0] = 2131558436;
            arrayOfInt[1] = 2131558522;
            arrayOfInt[2] = 2131558424;
            arrayOfInt[3] = 2131558525;
            arrayOfInt[4] = 2131558551;
            arrayOfInt[5] = 2131558526;
            arrayOfInt[6] = 2131558553;
            com.netease.pris.activity.a.ad localad = new com.netease.pris.activity.a.ad(this, 2, 2130903087, arrayOfString, arrayOfInt);
            this.x.a("title" + i1, localView);
            this.x.a("data" + i1, localad);
          }
          bool = localLinkedList.isEmpty();
        }
        while (!bool);
      }
      return;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
    }
    finally
    {
    }
    throw localObject;
  }

  private void f()
  {
    this.v = ((ProgressBar)findViewById(2131558412));
    this.u = ((TextView)findViewById(2131558409));
    this.w = ((ListView)findViewById(2131558550));
    this.w.setDivider(null);
    this.w.setDividerHeight(0);
    this.z = LayoutInflater.from(this).inflate(2130903048, null);
    this.w.addFooterView(this.z);
    this.A = ((LinearLayout)this.z.findViewById(2131558426));
    this.B = ((ProgressBar)this.z.findViewById(2131558427));
    this.C = ((TextView)this.z.findViewById(2131558428));
    this.D = ((RelativeLayout)findViewById(2131558507));
    this.E = ((AutoCompleteTextView)findViewById(2131558514));
    this.F = ((ImageView)findViewById(2131558515));
    this.G = ((ImageView)findViewById(2131558516));
  }

  private void g()
  {
    try
    {
      if (this.u != null)
        this.u.setOnClickListener(this.e);
      if (this.y != null)
        this.y.a(this.e);
      if (this.w != null)
      {
        this.w.setOnItemClickListener(this.I);
        this.w.setOnScrollListener(this.f);
      }
      this.E.addTextChangedListener(this.H);
      this.E.setHint(2131361913);
      this.F.setOnClickListener(this.e);
      this.G.setOnClickListener(this.e);
      this.G.setClickable(false);
      this.G.setEnabled(false);
      return;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
    }
    finally
    {
    }
    throw localObject;
  }

  private void h()
  {
    this.x = new com.netease.pris.activity.a.al();
    String[] arrayOfString = new String[7];
    arrayOfString[0] = "icon";
    arrayOfString[1] = "mark";
    arrayOfString[2] = "title";
    arrayOfString[3] = "content";
    arrayOfString[4] = "ratingbar";
    arrayOfString[5] = "button";
    arrayOfString[6] = "subs";
    int[] arrayOfInt = new int[7];
    arrayOfInt[0] = 2131558436;
    arrayOfInt[1] = 2131558522;
    arrayOfInt[2] = 2131558424;
    arrayOfInt[3] = 2131558525;
    arrayOfInt[4] = 2131558551;
    arrayOfInt[5] = 2131558526;
    arrayOfInt[6] = 2131558553;
    this.y = new com.netease.pris.activity.a.ad(this, 2, 2130903087, arrayOfString, arrayOfInt);
    this.y.e(this.j);
    this.w.setAdapter(this.x);
    this.w.removeFooterView(this.z);
  }

  private void r()
  {
    if (this.p != null)
    {
      this.k = 1;
      int i1 = a(304, null, this.p, null);
      this.s.put(new Integer(i1), this.p);
      this.w.addFooterView(this.z);
      c();
      b(true);
    }
  }

  public void b()
  {
    setTitle(2131361870);
    this.u.setBackgroundDrawable(k.a(this).b(2130837812));
    this.u.setText(getString(2131361980));
    int i1 = com.netease.image.c.a(this.d, 8.0F);
    ((LinearLayout)findViewById(2131558405)).setPadding(0, 0, i1, 0);
  }

  public void c()
  {
    this.u.setVisibility(8);
    this.v.setVisibility(0);
  }

  public void e()
  {
    this.u.setVisibility(0);
    this.v.setVisibility(8);
  }

  public void f_()
  {
    if (this.u != null)
      this.u.setBackgroundDrawable(k.a(this).b(2130837812));
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    switch (paramInt1)
    {
    default:
    case 4097:
    }
    String str;
    AutoCompleteTextView localAutoCompleteTextView;
    while (true)
    {
      return;
      if ((paramInt2 != -1) || (paramIntent == null))
        break;
      Bundle localBundle = paramIntent.getExtras();
      if (localBundle == null)
        continue;
      str = localBundle.getString("extra_query");
      this.E.setText(str);
      localAutoCompleteTextView = this.E;
      if (str != null)
        break label85;
    }
    label85: for (int i1 = 0; ; i1 = str.length())
    {
      localAutoCompleteTextView.setSelection(i1);
      break;
      break;
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903089);
    this.d = this;
    this.s = new HashMap();
    this.r = new Stack();
    this.l = 1;
    this.k = 0;
    this.j = com.netease.b.a.d.f();
    this.t = ((InputMethodManager)getSystemService("input_method"));
    v.a().a(this.g);
    f();
    h();
    g();
    b();
    this.o = this.n;
    int i1 = a(2, null, null, null);
    this.s.put(new Integer(i1), this.n);
    c();
  }

  public void onDestroy()
  {
    super.onDestroy();
    v.a().b(this.g);
    com.netease.image.d.a().a(this.j);
    if (this.v != null)
      this.v.setVisibility(8);
    if (this.B != null)
      this.B.setVisibility(8);
    if (this.r != null)
      this.r.clear();
    if (this.s != null)
      this.s.clear();
    if (this.y != null)
      this.y.b();
    if (this.x != null)
      this.x.a();
    if (this.e != null)
      this.e = null;
    if (this.f != null)
      this.f = null;
    if (this.I != null)
      this.I = null;
    if (this.w != null)
      this.w = null;
    this.p = null;
    this.o = null;
    this.z = null;
    this.A = null;
    this.B = null;
    this.C = null;
    this.d = null;
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (4 != paramInt);
    boolean bool;
    com.netease.pris.activity.view.al localal;
    String str;
    do
    {
      do
      {
        bool = super.onKeyDown(paramInt, paramKeyEvent);
        return bool;
      }
      while (this.r.empty());
      localal = (com.netease.pris.activity.view.al)this.r.pop();
      str = localal.a;
      this.m = localal.b;
    }
    while (str == null);
    this.s.clear();
    this.p = null;
    if (str.equals(this.n))
      this.l = 1;
    int i1;
    for (int i2 = a(2, null, null, null); ; i2 = i1)
    {
      this.s.put(new Integer(i2), str);
      c();
      b(false);
      this.k = 0;
      this.o = str;
      bool = true;
      break;
      this.l = 2;
      i1 = a(304, null, str, null);
      com.netease.pris.d.c.a(p(), 1699, localal.c);
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.MallListActivity
 * JD-Core Version:    0.6.0
 */